package com.wp.service.Impl;

import com.wp.service.BookShopService;
import com.wp.service.ShoppingCarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: WangPeng
 * @createTime: 2022/11/14 18:58
 * @description:
 * @version: v1.0
 */
@Service
public class ShoppingCarServiceImpl implements ShoppingCarService {
    @Autowired
    private BookShopService bookShopService;
    @Override
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void buyManyBook(List<String> isbns, String username) {
        for (String isbn : isbns) {
            bookShopService.buyBook(isbn,username);
        }
    }
}
